package com.yuanheng100.ems4j.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

import com.yuanheng100.ems4j.model.Ems4jEmployee;

public interface Ems4jEmployeeMapper {


    @Insert({
        "insert into ems4j_employee (userid, name, ",
        "department, mobile, ",
        "email, position, ",
        "password, idcardno, entrydate, ",
        "deletedate, empstatus, ",
        "appids, weixinid, ",
        "weixinavatarmediaid, dingtel, ",
        "dingworkplace, dingjobnumber, ",
        "dingissenior, dingisleaderindepts)",
        "values (#{userid,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, ",
        "#{department,jdbcType=INTEGER}, #{mobile,jdbcType=BIGINT}, ",
        "#{email,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, ",
        "#{password,jdbcType=CHAR}, #{idcardno,jdbcType=CHAR}, #{entrydate,jdbcType=DATE}, ",
        "#{deletedate,jdbcType=DATE}, #{empstatus,jdbcType=SMALLINT}, ",
        "#{appids,jdbcType=VARCHAR}, #{weixinid,jdbcType=VARCHAR}, ",
        "#{weixinavatarmediaid,jdbcType=VARCHAR}, #{dingtel,jdbcType=INTEGER}, ",
        "#{dingworkplace,jdbcType=VARCHAR}, #{dingjobnumber,jdbcType=VARCHAR}, ",
        "#{dingissenior,jdbcType=SMALLINT}, #{dingisleaderindepts,jdbcType=VARCHAR})"
    })
    int insert(Ems4jEmployee record);




    @Select({
        "select",
        "userid, name, department, mobile, email, position, password, idcardno, entrydate, ",
        "deletedate, empstatus, appids, weixinid, weixinavatarmediaid, dingtel, dingworkplace, ",
        "dingjobnumber, dingissenior, dingisleaderindepts",
        "from ems4j_employee",
        "where userid = #{userid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="userid", property="userid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="department", property="department", jdbcType=JdbcType.INTEGER),
        @Result(column="mobile", property="mobile", jdbcType=JdbcType.BIGINT),
        @Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
        @Result(column="position", property="position", jdbcType=JdbcType.VARCHAR),
        @Result(column="password", property="password", jdbcType=JdbcType.CHAR),
        @Result(column="idcardno", property="idcardno", jdbcType=JdbcType.CHAR),
        @Result(column="entrydate", property="entrydate", jdbcType=JdbcType.DATE),
        @Result(column="deletedate", property="deletedate", jdbcType=JdbcType.DATE),
        @Result(column="empstatus", property="empstatus", jdbcType=JdbcType.SMALLINT),
        @Result(column="appids", property="appids", jdbcType=JdbcType.VARCHAR),
        @Result(column="weixinid", property="weixinid", jdbcType=JdbcType.VARCHAR),
        @Result(column="weixinavatarmediaid", property="weixinavatarmediaid", jdbcType=JdbcType.VARCHAR),
        @Result(column="dingtel", property="dingtel", jdbcType=JdbcType.INTEGER),
        @Result(column="dingworkplace", property="dingworkplace", jdbcType=JdbcType.VARCHAR),
        @Result(column="dingjobnumber", property="dingjobnumber", jdbcType=JdbcType.VARCHAR),
        @Result(column="dingissenior", property="dingissenior", jdbcType=JdbcType.SMALLINT),
        @Result(column="dingisleaderindepts", property="dingisleaderindepts", jdbcType=JdbcType.VARCHAR)
    })
    Ems4jEmployee selectByPrimaryKey(Integer userid);



    @Update({
        "update ems4j_employee",
        "set name = #{name,jdbcType=VARCHAR},",
          "department = #{department,jdbcType=INTEGER},",
          "mobile = #{mobile,jdbcType=BIGINT},",
          "email = #{email,jdbcType=VARCHAR},",
          "position = #{position,jdbcType=VARCHAR},",
          "password = #{password,jdbcType=CHAR},",
          "idcardno = #{idcardno,jdbcType=CHAR},",
          "entrydate = #{entrydate,jdbcType=DATE},",
          "deletedate = #{deletedate,jdbcType=DATE},",
          "empstatus = #{empstatus,jdbcType=SMALLINT},",
          "appids = #{appids,jdbcType=VARCHAR},",
          "weixinid = #{weixinid,jdbcType=VARCHAR},",
          "weixinavatarmediaid = #{weixinavatarmediaid,jdbcType=VARCHAR},",
          "dingtel = #{dingtel,jdbcType=INTEGER},",
          "dingworkplace = #{dingworkplace,jdbcType=VARCHAR},",
          "dingjobnumber = #{dingjobnumber,jdbcType=VARCHAR},",
          "dingissenior = #{dingissenior,jdbcType=SMALLINT},",
          "dingisleaderindepts = #{dingisleaderindepts,jdbcType=VARCHAR}",
        "where userid = #{userid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Ems4jEmployee record);
}